
package com.be.beadmin.product.repository;

import com.be.beadmin.product.entity.WrokingHoursOverView;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
* @author zjm
* @date 2023-04-24
**/
public interface WrokingHoursOverViewRepository extends JpaRepository<WrokingHoursOverView, String>, JpaSpecificationExecutor<WrokingHoursOverView> {

    WrokingHoursOverView findWrokingHoursOverViewByIdAndDelete(String id, Integer delete);

    WrokingHoursOverView findWrokingHoursOverViewByProcessIdAndDelete(String id, Integer delete);


    @Query(value = "select max(who.timeFlag) from WrokingHoursOverView who where who.processId = ?1 and who.delete = ?2")
    Integer findTimeFlagByProcessIdAndDelete(String id, Integer delete);

    WrokingHoursOverView findWrokingHoursOverViewByProcessIdAndUserIdAndDelete(String id,String userId, Integer delete);


    WrokingHoursOverView findWrokingHoursOverViewById(String id);

}